package com.ebs.md.api;

import com.ebs.md.api.hit.HitSide;

/**
 * Perforce Revision:
 *  $File: //depot/MarketData/commons-md-api/MAIN/src/main/java/com/ebs/md/api/BookSide.java $
 *  $Revision: #2 $  $Change: 114786 $  $DateTime: 2012/09/10 08:47:19 $  $Author: Arik.Sher $
 */

public enum BookSide {
	 BID   (OrderSide.BID)
	,OFFER (OrderSide.OFFER)
	;
	
	private OrderSide orderSide; 
	 
	private BookSide(OrderSide orderSide) {
		this.orderSide = orderSide;
	}

	public OrderSide getOrderSide() {
		return orderSide;
	}

	public BookSide getOtherSide() {
		if ( this.equals(BID) ) {
			return OFFER;
		}
		if ( this.equals(OFFER) ) {
			return BID;
		}
		return null;
	}

	public HitSide getMatchHitSide() {
		return orderSide.getMatchHitSide();
	}

	public static BookSide fromOrderSide(OrderSide orderSide) {
		if ( BID.orderSide.equals(orderSide) ) {
			return BID;
		}
		if ( OFFER.orderSide.equals(orderSide) ) {
			return OFFER;
		}
		return null;
	}
	
}
